
//打开新窗口
function WinOpen(winname) {
    console.log('<<<<<<<<<<' + winname.replace('../', '').replace('/', '_'))
    api.openWin({
        name: winname.replace('../', '').replace('/', '_'),
        url: './' + winname + '.html',
        softInputBarEnabled: false,
        hideHomeIndicator: true
    });
}

//关闭当前窗口
function WinClose() {
    api.closeWin();
}
//关闭所有窗口
function AllWinClose() {
    api.closeToWin({
        name: 'root'
    });
}

//打开标准Frame
function FrameOpen(framename, pageParam, bgColor) {
    var header_h = 0;
    if ($api.byId('header')) {
        header_h = $api.byId('header').offsetHeight;
    }
    if (!bgColor) {
        bgColor = '#f5f5f5';
    }
    api.openFrame({
        name: framename.replace('../', '').replace('/', '_'),
        url: './' + framename + '.html',
        rect: {
            marginTop: header_h,
            // marginBottom: iPhoneX
            marginBottom: 0

        },
        pageParam: pageParam,
        bgColor: bgColor
    });
}

//关闭当前Frame
function FrameClose() {
    api.closeFrame();
}

//显示底部提示
function ToastOpen(text) {
    api.toast({
        msg: text,
        duration: 3000,
        location: 'bottom'
    });
}
